<script>
	import util from './static/utils/util.js'
	export default {
		onLaunch: function() {
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},

		methods: {
			//登录公共接口，isLaunch是否跳转主页
			async noticeList(room, isLaunch = true) {
				var url = '/UserServer/weChat/ownerLogin'
				var phone = wx.getStorageSync('phone');
				var openId = wx.getStorageSync('openId');
				var userInfo = wx.getStorageSync('userInfo');
				var params = {
					"telephone": phone,
					"roomIdNow": room.roomId,
					"openId": openId,
					"portraitUrl": userInfo.avatarUrl
				}
				var options = {
					url,
					params,
					method: "POST",
				}
				var param = await util.requestPro(options)
				wx.setStorageSync('room', room);
				wx.setStorageSync('userMsg', param);
				if (param.isDev) {
					wx.setStorageSync('isDev', param.isDev); //内部员工字段标记
				}
				//不需要跳转主页则返回
				if (!isLaunch) {
					return
				}
				wx.reLaunch({
					url: '/pages/index/index'
				})
			},
		},

		globalData: {
			installSite: '',
			equipment: '',
			roomList: '',
		}
	}
</script>

<style>
	/*每个页面公共css */
	@import url("./style/common.css");

	/* 	button {
		padding: 0;
	} */
	button::after {
		border: 0 !important;
	}
</style>
